
<html>
<head>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<style>
/*字体 https://www.jb51.net/css/23416.html*/
.inputa{
	width:40%;
    font-size:18px;
	border-width : 0 0 1px 0;
	background-color:#e6e6e6;
	height: 40px;
	font-family: 'Courier New', Courier, monospace;
}
.inputa:focus{
	outline: none;
}
.inputb{
	width:40%;
    font-size:18px;
    border-width: 0px;
    background-color: #e6e6e6;
	font-family: 'Courier New', Courier, monospace;
}
input::placeholder{
    color:#d2d2d2;
}



input::-webkit-input-placeholder{ /*WebKit browsers*/
font-style:italic;
}


input::-ms-input-placeholder{ /*Internet Explorer*/ 
font-style:italic;
}
.divbg{
	background-color:#e6e6e6;
}
.tixing{
	animation:mytx 5s 1;
	-webkit-animation:mytx 1s 1; /* Safari 和 Chrome */
	animation-timing-function: ease;
}
@keyframes mytx
{
	0%   {color:red;}
	100% {color:black;}
}
@-webkit-keyframes mytx /* Safari 和 Chrome */
{
	0%   {color:red;}
	100% {color:black;}
}
</style>

</head>

<body onkeydown="if(event.keyCode===13){cc()}">
<div class="divbg" >
	<input  class="inputa inputData" />
	<input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<div class="divbg" >
	<input  class="inputa inputData" />
	<input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<div class="divbg" ><input  class="inputa inputData" /><input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<div class="divbg" ><input  class="inputa inputData" /><input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<div class="divbg" ><input  class="inputa inputData" /><input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<div class="divbg" ><input  class="inputa inputData" /><input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<div class="divbg" ><input  class="inputa inputData" /><input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<div class="divbg" ><input  class="inputa inputData" /><input  class="inputa" placeholder='请输入备注'/> <br/>
	<input  class="inputb resultData"  disabled/> <br/>
</div>
<label>
	<input type="checkbox"  onchange="checkBoxChange()"  />
	结果格式化（千分位）
</label><br>
<a href="replace.html">替换工具</a>
<input type="button" onclick="cc()" value="计算" />




<script >

	var formatQfe = false;
function cc(){

	console.log($('.divbg'));
	$('.divbg').each(function(i,item){

		var bdsValue = $(item).find('.inputData').val();
		bdsValue = bdsValue.replace(/,/g, "");
		var val2 = '';

		try {
			val2 = eval(bdsValue);
		} catch(err) {
			val2='';
		}


		if(formatQfe&&val2){
			val2 = val2.toLocaleString();
		}
		console.log(val2);
		let resData = $(item).find('.resultData');
		if(resData.val()==val2){

		}else{
			resData.removeClass('tixing');
			setTimeout(() => {
				resData.addClass('tixing');
			},0);
			resData.val(val2);
		}
	});

}
function checkBoxChange(){
		formatQfe=!formatQfe;
		cc();
	}

</script>
</body>
</html>